<?php if (!defined('THINK_PATH')) exit();?><style>
    .uploadpic {
        float: left;
        width: 295px;
        text-align: center;
        height: 165px;
    }

    .uploadpic h3 {
        text-align: left;
        border: 1px solid #95B8E7;
        float: left;
        padding: 4px;
        background-color: #95B8E7;
        color: #FFF;
    }

    .up-content {
        border: 1px solid #95B8E7;
        padding: 4px;
    }

    .w10 {
        float: left;
        width: 10px;
        color: #FFF;
    }

    .items {
        padding: 10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }

    #dd div {
        padding-right: 10px;
        padding-bottom: 10px;
    }

    .addItems {
        float: left;
    }

    /*表格样式  */
    .add_table {
        width: 100%;
        border: 1px solid #0e90d2;
    }

    .add_table th {
        width: 80px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right: solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }

    .add_table td {
        border-bottom: solid 1px #95B8E7;
    }

    .add_table tr {
        border: solid 1px #95B8E7;
    }

    .tb_head {
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }

    .inline {
        display: inline;
        padding-right: 5px;
    }

    .row_container {
        padding: 8px 5px 5px 5px;
    }


    .add_zl_title{
        font-size: 20px;
        color: #0e2d5f;
        text-align: center;
        padding: 10px;
        font-weight: bold;
    }
</style>
<div class="add_zl_title">添加质量问题</div>
    <form id="add_zl_form" action="/degs/index.php/Home/Quality/add_quality" enctype="multipart/form-data" method="post" style="padding:10px;">
        <table class="add_table">
            <tr>
                <th>生产信息</th>
                <td>
                    <div class="row_container" style="background: #FFFEE6;">
                        <div class="inline">
                            <span class="add_label">稽查日期：</span>
                            <input id="creatdate" name="finddate" class="easyui-datebox"
                                   data-options="required:true,showSeconds:true" style="width:120px">
                        </div>
                        <div class="inline">
                            <span class="add_label">车间：</span>
                            <input id="cj_add" name="cj" class="easyui-textbox"
                                   data-options="iconCls:'',editable:true,required:false,panelHeight:'auto'"
                                   style="width:100px"/>
                        </div>
                        <div class="inline">
                            <span class="add_label">工位：</span>
                            <input id="gw_add" class="easyui-combogrid" data-options="editable:false,required:false"
                                   name="gw" style="width:200px;"/>


                        </div>

                        <div class="inline">
                            <span class="add_label">工段：</span>
                            <select id="dw" class="easyui-combobox" name="dw" style="width:100px;"
                                    data-options="editable:false,required:false,panelHeight:'auto',multiple:'true'">

                                <option value=""  selected="selected">.</option>
                                <option value="1">一工段</option>
                                <option value="2">二工段</option>

                            </select>


                        </div>

                        <div class="inline">
                            <span class="add_label">任务来源：</span>
                            <select id="ly" class="easyui-combobox" name="ly" style="width:100px;"
                                    data-options="editable:false,required:true,panelHeight:'auto'">
                                <option value="0" selected="selected">/</option>
                                <option value="1">X3000专项</option>
                                <option value="2">载货车专项</option>
                                <option value="3">大模块水箱问题</option>
                                <option value="4">中联重科专项</option>
                                <option value="5">三一重工专项</option>
                                <option value="6">中石油专项</option>
                                <option value="7">非专项填写</option>
                            </select>
                        </div>



                    </div>
                </td>
            </tr>
            <th>基本信息</th>
            <td style="background-color:rgba(204, 204, 204, 0.4);">
                <div class="row_container">

                    <div class="panel" style="display: block;">
                        <div class="easyui-panel panel-body panel-body-noheader" style="padding: 5px; width: 100%;"
                             title="">
                            <span class="add_label">流水号</span>
                            <input id="lshpp" class="easyui-textbox" data-options=""/>
                            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                               onclick="pipei()">匹配</a>
                            <span class="add_label">车型：</span>
                            <input id="cx" name="cx" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px"/>

                            <span class="add_label">计生号：</span>
                            <input id="jsh" name="jsh" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px"/>

                            <span class="add_label">流水号区间：</span>
                            <input id="lshqj" name="" class="easyui-textbox"
                                   data-options="iconCls:'',editable:false,required:true" style="width:150px"/>
                            <span class="add_label">是否重复：</span>
                            <select id="cf" class="easyui-combobox" name="repeat" style="width:100px;"
                                    data-options="editable:false,required:true,panelHeight:'auto'">
                                <option value="1" selected="selected" value="非">非</option>
                                <option value="2">是</option>
                            </select>
<br>
                            <span class="add_label">问题流水号：</span>
                            <input id="" name="lsh" class="easyui-textbox"
                                   data-options="iconCls:'',editable:true,required:true" style="width:300px"/>
                        </div>
                    </div>
                </div>



            </td>
            </tr>
            <!--<tr>-->
                <!--<th>文件编asdad号</th>-->
                <!--<td>-->
                    <!--&lt;!&ndash; textarea name="chuli" class="easyui-textbox" id="chuli" style="width: 100%; height: 46px;" onkeyup="" data-options="required:true"></textarea> &ndash;&gt;-->
                    <!--<input id="fileid" name="fileid" class="easyui-textbox"-->
                           <!--data-options="multiline:false,editable:true,prompt:'请输入文件编号……',required:true"-->
                           <!--style="width:60%;">-->
                    <!--<br/>-->
                <!--</td>-->
            <!--</tr>-->
            <tr>
                <th>稽查内容名称/零部件名称</th>
                <td>
                    <textarea name="content" class="easyui-textbox" id="content" style="width: 100%; height: 46px;"
                              data-options="required:true"></textarea>
                    <br/>
                </td>
            </tr>
            <tr>
                <th>工艺要求</th>
                <td>
                    问题类别:<select id="lb" class="easyui-combobox" name="lb" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                    <option value="1">三检</option>
                    <option value="2">三不</option>
                    <option value="3">三按（工艺执行）</option>
                    <option value="4">三按（工艺转换）</option>
                </select>
                    <br>
                    <textarea name="gy" class="easyui-textbox" id="gy" style="width: 100%; height: 46px;"
                              data-options="required:true"></textarea>
                    <br/>
                </td>
            </tr>
            <tr>
                <th>问题描述</th>
                <td>
                    <textarea name="discr" class="easyui-textbox" id="discr" style="width: 100%; height: 46px;"
                              data-options="required:true"></textarea>
                    <br/>
                </td>
            </tr>



            <tr>
                <th>上传图片</th>
                <td>
                    <div class="easyui-panel" style="padding:5px;">
                        <input  name="pics[]" id="pics"  style="width:80%;"  data-options="multiple:true,buttonText:'上传图片',buttonIcon:'icon-standard-bullet-picture',buttonAlign:'right',accept:'image/*'"
                               class="easyui-filebox">
                    </div>



                </td>
            </tr>
            <tr>
                <th>问题类别/问题项目</th>
                <td>
                    <!-- textarea name="chuli" class="easyui-textbox" id="chuli" style="width: 100%; height: 46px;" onkeyup="" data-options="required:true"></textarea> -->


                    项目:
                    <select id="xm" class="easyui-combobox" name="xm" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="1">管路打折</option>
                        <option value="9">缺捆扎、固定</option>
                        <option value="11">干涉</option>
                        <option value="12">间隙小</option>
                        <option value="13">装调问题</option>


                        <option value="2">错漏装</option>
                        <option value="3">三漏问题</option>
                        <option value="4">外观质量问题</option>
                        <option value="5">松装（力矩不足、力矩未检测）</option>
                        <option value="6">未做标记（标记不规范</option>
                        <option value="7">未执行“三按”</option>
                        <option value="8">一致性</option>
                        <option value="10">其它</option>
                    </select>
                    三检执行情况：
                    <select id="sj" class="easyui-combobox" name="sj" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="未自检">未自检</option>
                        <option value="未互检">未互检</option>
                        <option value="未专检">未专检</option>
                        <option value="弄虚作假">弄虚作假（自检、互检、专检）</option>
                        <option value="比例不足（自检、互检、专检）">比例不足（自检、互检、专检）</option>
                        <option value="合格填写（已自检、已互检、已专检）">合格填写（已自检、已互检、已专检）</option>
                    </select>
                    <select id="result" class="easyui-combobox" name="result" style="width:200px;" data-options="editable:false,required:true,panelHeight:'auto'">
                        <option value="合格">合格</option>
                        <option value="不合格" selected="selected">不合格</option>
                    </select>
                
                    稽查员：
                    <select id="jsy" class="easyui-combobox" name="jcy" style="width:200px;" data-options="editable:true,required:true,panelHeight:'auto'">
                        <option value="邱忠让">邱忠让</option>
                        <option value="王静">王静</option>
                        <option value="王立新">王立新</option>
                        <option value="见晓荣">见晓荣</option>
                        <option value="李明昌">李明昌</option>
                        <option value="石卫国">石卫国</option>
                        <option value="李哲">李哲</option>
                        <option value="王爱国">王爱国</option>
                    </select>
                        <br/>
                </td>
            </tr>
            <tr>
                <th>备注</th>
                <td>

                    <textarea name="beizhu" class="easyui-textbox" id="beizhu" style="width: 100%; height: 46px;" onkeyup=""
                              data-options=""></textarea>
                    <br/>
                </td>
            </tr>
        </table>
        <input type="hidden" name="status" id="status" value="待处理">
        <input type="hidden" name="userid" id="userid" value=<?php echo ($_SESSION['uid']); ?>>
        <input type="hidden" name="author" id="author" value=<?php echo ($_SESSION['uname']); ?>>
        <input type="hidden" name="nickname" id="nickname" value=<?php echo ($_SESSION['unickname']); ?>>
    </form>


<!--<div id="dlg-add">-->
    <!--<div class="tool_tip">添加记录后会在列表中出现！！</div>-->
    <!--<a href="#" id="addok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'"-->
       <!--onclick="add()">确认</a>-->
    <!--<a href="#" class="easyui-linkbutton"-->
       <!--data-options="iconCls:'icon-cancel'"-->
       <!--onclick="javascript:$('#add').dialog('close')">取消</a>-->
<!--</div>-->

<div style="background-color: #E0ECFF;
    bottom: 0px;
    position: absolute;
    width: 100%;
    border: 1px solid #95b8e7;">
    <a href="#" class="easyui-linkbutton" onclick='newZl()'
       data-options="iconCls:'icon-standard-page-word',plain:true">新建质量问题</a>
    <a href="#"  class="easyui-linkbutton" onclick='clearForm()'
       data-options="iconCls:'icon-standard-coins-delete',plain:true">清空</a>
    <a href="#"  class="easyui-linkbutton" onclick='back_zl_list()'
       data-options="iconCls:'icon-standard-cup-go',plain:true">返回</a>
</div>
<script>



    $('#lb').combobox({
        onSelect: function(param){
            console.log(param)

            var n=param.value-1;
            var str=['工作自检、互检与专检相结合以确保正确无误,自检七步法，互检三步法，专检五步法。','对缺少标识，未经检验及不合格的零部件不得装配使用，装配前应主动检查零部件的正确性和外观质量，发现不合格产品及零部件不应装配，应及时向质量人员报告。','1.装配工在装配之前，应首先熟悉本工位的工艺文件、图纸及技术要求；并在装配工作中，严格执行工艺及产品图纸等技术要求。2.装配完毕后，装配工应自检所装配的内容是否符合工艺要求，保证质量，最后应及时在整车装配检验跟单上签名。3.装配中所使用的各种工具、夹具、量具应符合工艺要求、且具备合格标准及完整性。4.各零部件及分总成，在装配中应保持清洁干净，不应直接接触地面，装配场地应清洁整齐，做到文明生产。5.装配工作中作业人员不得擅自更改装配挂单等工艺文件，防止错装、漏装；工作自检、互检与专检相结合以确保正确无误。','设计文件未及时转化'];
            $('#gy').textbox('setText',str[n]);
            console.log(str[n])

            // str[param.value]
        }
    });


    function back_zl_list(){
        var tab = $('#tab').tabs('getSelected');
        tab.panel('refresh', APP+'/Home/Zhiliang/index');
    }
    function newZl(){
        $('#add_zl_form').form('submit', {

            url :APP+ '/Home/Zhiliang/add',
            onSubmit: function(param){
                param.gy = $('#gy').textbox('getText');
            },

            success : function(data) {
                $('#add_zl_form').form('clear');
                $.messager.confirm('确认',data+'是否要返回列表页面',function(r){
                    if (r){
                        var tab = $('#tab').tabs('getSelected');
                        tab.panel('refresh', APP+'/Home/Zhiliang/index');
                    }
                });
            }
        });
    }
function clearForm(){
    $.messager.confirm('确认','您确认想要清空记录吗？',function(r){
        if (r){
            $('#add_zl_form').form('clear');
        }
    });
}

    $('#cj_add').combobox({
        valueField: 'id',
        url: APP+'/Admin/Trem/cjList',
        textField: 'title',
        editable: false,
        onSelect: function (rec) {
            $('#gw_add').combogrid({
                panelWidth: 200,
                idField: 'title',
                textField: 'title',
                multiple: true,
                striped: true,
                url: APP+'/Admin/Trem/cjList?pid=' + rec.id,
                columns: [[
                    {field: 'title', title: '名称', width: 120}
                ]]
            });
            $('#gw_add').combobox('clear');
        }
    });


    // 匹配MES信息
    function pipei() {

        // 匹配之前西安清空
        $('#lshqj').textbox('clear');
        $('#jsh').textbox('clear');
        $('#cx').textbox('clear');

        // $('#fkbm').textbox('clear');
        var lsh = $('#lshpp').textbox('getText');
        if (lsh != "") {
            $.post("/degs/index.php/Home/Zhiliang/pipei", {lsh: lsh}, function (result) {
                // $("span").html(result);
                console.log(result);
                if (result.status == '1') {
                    $('#lshqj').textbox('setValue', result.data.lshqj);
                    $('#jsh').textbox('setValue', result.data.sjjhh);
                    $('#cx').textbox('setValue', result.data.cl);

                } else {
                    $.messager.alert('匹配车型信息', result.data, 'info');
                }

            }, "json");
        } else {
            $.messager.alert('匹配车型信息', '请输入流水号', 'info');
        }
    }


</script>